<template>
  <div id="apply">
    <div class="apply-h">
      <div class="item">
        <div class="nav active">提交资料</div>
        <div class="icon-arrow"></div>
      </div>
      <div class="item">
        <div class="nav active">支付年会员费</div>
        <div class="icon-arrow"></div>
      </div>
       <div class="item">
        <div class="nav active">升级成功</div>
      </div>
    </div>
    <div class="apply-b">
      <span class="title">升级成功</span>
      <!-- <span class="goBtn" @click="back">返回</span>
      <div style="clear:both;"></div> -->
      <div class="apply-b-c">
        <div>
          <div class="icon-extra-suc"></div>
          <div class="tit">恭喜您支付成功</div>
          <div class="warn">会员有效期至{{time}}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        time: ''
      }
    },
    created() {
      // 先从localStorage中获取数据
      let userInfo = JSON.parse(localStorage.getItem('userInfo') || '{}')

      // 如果获取的用户名存在（之前保存在了localStorage中了）
      if (userInfo.userName) {
        // 更新用户信息
        this.$store.commit('updateUserInfo', userInfo)
      }
    },
    mounted() {
      const _this = this
      this.$store.dispatch('fetchApplyRoleInfo', {
        token: this.$store.getters.token,
        callback(data) {
          _this.time = data.date ? data.date.split(' ')[0] : ''
        }
      })
    }
  }
</script>

<style lang="scss" scoped>
  .apply-h{
    height: 60px;
    background-color: #fff;
    padding: 10px 60px;
    margin-bottom: 10px;
    text-align: center;
  }
  .item{
    margin-left: 35px;
    display: inline-block;
  }
  .active{
    background-color: #F00384 !important;
    color:#fff !important;
  }
  .nav{
    width: 160px;
    height: 40px;
    background-color: #ddd;
    color: #999;
    border-radius: 6px;
    display: inline-block;
    line-height: 40px;
    text-align: center;
  }
  .icon-arrow{
    display: inline-block;
    width: 12px;
    height: 24px;
    vertical-align: middle;
    margin-left: 35px;
    background: url('../../assets/ico-arrow-right1.png') no-repeat 0 0;
  }

  .apply-b {
    height: 338px;
    background-color: #fff;
    padding: 20px;
    .title {
      color: #666;
    }
    .goBtn {
      height: 28px;
      border: 1px solid;
      color: #F00384;
      line-height: 28px;
      text-align: center;
      padding: 0 20px;
      float: right;
    }
    &-c {
      height: 241px;
      border: 1px solid #ddd;
      margin-top: 14px;
      padding: 25px 60px;
      div{
        margin: auto;
        text-align: center;
      }
    }
  }


  .nextBtn{
    width: 160px;
    height: 38px;
    line-height: 38px;
    background-color: #F10180;
    color: #FFF;
    text-align: center;
    float: right;
  }
  .icon-extra-suc{
    width: 100px;
    height: 100px;
    background: url('../../assets/icon-extra-success.png') no-repeat 0 0 ;
  }
  .tit{
    font-size: 24px;
    padding-top: 30px;
    color: #666;
  }
  .warn{
    font-size: 14px;
    padding-top: 18px;
    color: #F00384;
  }
</style>